﻿using MessageQuque.Business.Model;
using MessageQuque.Client;
using MessageQuque.Common.Base.Business;
using MessageQuque.Common.Base.Task;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MessageQuque.Business.Tasks
{
    public class TestTask : TaskBase
    {
        public TestTask()
        {
            base.PeriodType = Common.Base.Task.PeriodType.Day;
        }

        /// <summary>
        /// 处理程序入口
        /// </summary>
        /// <remarks>执行成功会等待下个周期再执行，抛出异常任务会不断重试</remarks>
        public override void Process()
        {
            var sender = new Sender<TestModel>();

            var model = new TestModel();

            model.Message = "这是定时任务测试，发送时间：" + DateTime.Now.ToString();

            sender.Enqueue(model);
        }
        
    }
}
